]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main: Replace custom log function with console
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 1 Aug 2022 09:26:59 +0000 (11:26 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 10 Jul 2023 09:59:58 +0000 (09:59 +0000)
console.log() is implemented with structured logging, and as we
set an appropriate log domain, it's identical to the custom function
bar the custom fields with extension data.

Few people know about those custom fields, and adding them comes
at a cost, as we end up producing and parsing a stacktrace on
every log() call.

It therefore seems appropriate to drop the custom function, and
turn the global log() symbol into a simple convenience alias for
console.log().

If it turns out that people do miss the custom fields, we can add
an alternative to ExtensionUtils.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2830>

js/ui/main.js

index e1cc25afaabce484233a416682a04daa054f3d39..34a3b0e78d7e0718f3c0582ed9fa5cf0409219a7 100644 (file)
@@ -147,27 +147,9 @@ function _sessionUpdated() {
     }
 }
 
-/**
- * @param {any...} args a list of values to log
- */
-function _loggingFunc(...args) {
-    let fields = { 'MESSAGE': args.join(', ') };
-    let domain = 'GNOME Shell';
-
-    // If the caller is an extension, add it as metadata
-    let extension = imports.misc.extensionUtils.getCurrentExtension();
-    if (extension != null) {
-        domain = extension.metadata.name;
-        fields['GNOME_SHELL_EXTENSION_UUID'] = extension.uuid;
-        fields['GNOME_SHELL_EXTENSION_NAME'] = extension.metadata.name;
-    }
-
-    GLib.log_structured(domain, GLib.LogLevelFlags.LEVEL_MESSAGE, fields);
-}
-
 /** @returns {void} */
 async function start() {
-    globalThis.log = _loggingFunc;
+    globalThis.log = console.log;
 
     // Chain up async errors reported from C
     global.connect('notify-error', (global, msg, detail) => {